def create_class(name):
    if name == "user":
        class User:
            def __str__(self):
                return "user"
        return User

    elif name == "company":
        class Company:
            def __str__(self):
                return "company"
        return Company


def say(self):
    # return self.name
    return "I am user"


class BaseClass:
    def answer(self):
        return "I am base_class"


# type 动态创建类
User = type("User", (BaseClass, ), {"name": "user", "say": say})


if __name__ == '__main__':
    # test = create_class("user")
    # print(test())
    test = User()
    print(test.name)
    print(test.say())
    print(test.answer())